mod pubsub_publish_statement;
mod pubsub_subscribe_statement;

use std::sync::{Arc, Mutex};

use model_graph_types::{
    container::workflow::{
        PubsubPublishStatement, PubsubSubscribeStatement, WorkflowBlockExecuteResult,
        WorkflowHttpMethod,
    },
    modeling::Value,
};

use crate::workflow::context::WorkflowContext;

pub async fn publish_execute(
    statement: &PubsubPublishStatement,
    context: Arc<Mutex<WorkflowContext>>,
) -> anyhow::Result<WorkflowBlockExecuteResult> {
    //获取请求的方法
    return pubsub_publish_statement::execute(statement, context).await;
}

pub async fn subscribe_execute(
    statement: &PubsubSubscribeStatement,
    context: Arc<Mutex<WorkflowContext>>,
) -> anyhow::Result<WorkflowBlockExecuteResult> {
    //获取请求的方法
    return pubsub_subscribe_statement::execute(statement, context).await;
}
